﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Site.master" AutoEventWireup="true" CodeBehind="QLAlbum.aspx.cs" Inherits="Indochinaodyssey.Admin.QLAlbum" %>
<%@ Register assembly="FredCK.FCKeditorV2" namespace="FredCK.FCKeditorV2" tagprefix="FCKeditorV2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:Label ID="Label1" runat="server" Text="Quản lý Gallery" Font-Bold="True" 
        Font-Size="15pt"></asp:Label>
    <asp:MultiView ID="mtvTour" runat="server" ActiveViewIndex="0">
        <asp:View ID="viewTable" runat="server">
            <table class="style1">
                <tr>
                    <td>
                        &nbsp;</td>
                    <td align="right">
                        <asp:Label ID="lblMes" runat="server"></asp:Label>
                        &nbsp;<asp:Button ID="btnCre" runat="server" Text="Tạo Tours" 
                            onclick="btnCre_Click" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSourceTours" 
                            Width="100%" AutoGenerateColumns="False" BackColor="White" 
                            BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3" 
                            DataKeyNames="ID" GridLines="Vertical" AllowPaging="True" 
                            AllowSorting="True" onrowcommand="GridView1_RowCommand">
                            <AlternatingRowStyle BackColor="#DCDCDC" />
                            <Columns>
                                <asp:BoundField DataField="ROW" HeaderText="STT" SortExpression="ROW" />
                                <asp:BoundField DataField="TieuDe" HeaderText="TÊN HOTEL" 
                                    SortExpression="TieuDe" />
                                <asp:ImageField DataImageUrlField="HinhAnh"  ControlStyle-Height="75px"  ControlStyle-Width="80px" 
                                    DataImageUrlFormatString="~/Images/HinhAnh/{0}" HeaderText="HÌNH ẢNH">
                                    
                                    <ControlStyle Height="75px" Width="80px" />
                                    
                                </asp:ImageField>
                                <asp:BoundField DataField="TenTheLoai" HeaderText="DANH MỤC PHỤ" 
                                    SortExpression="TenTheLoai" />
                                <asp:BoundField DataField="TenDanhMuc" HeaderText="DANH MỤC CHÍNH" 
                                    SortExpression="TenDanhMuc" />
                                <asp:BoundField DataField="STT" HeaderText="VỊ TRÍ HIỆN THỊ" 
                                    SortExpression="STT" />
                                <asp:CheckBoxField DataField="Hot" HeaderText="TOURS HOT" 
                                    SortExpression="Hot" />
                                <asp:TemplateField Visible="False">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lbtnHinhAnh" runat="server" CommandName="anh" 
                                            CommandArgument='<%# Eval("ID") %>'>Thêm Ảnh</asp:LinkButton>
                                        &nbsp;-
                                        <asp:LinkButton ID="lbtnNoiDung" runat="server" CommandName="noidung" 
                                            CommandArgument='<%# Eval("ID") %>'>Nội dung</asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="ACTION">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="btnEditT" runat="server" onclick="btnEditT_Click">Sửa</asp:LinkButton>
                                        &nbsp;-
                                        <asp:LinkButton ID="btnDel" runat="server" onclick="btnDel_Click" 
                                            onclientclick="return confirm('Bạn chắc chắn muốn xóa?');">Xóa</asp:LinkButton>
                                        <asp:HiddenField ID="hfID" runat="server" Value='<%# Eval("ID") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
                            <HeaderStyle BackColor="#26567E" Font-Bold="True" ForeColor="White" />
                            <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
                            <RowStyle BackColor="#EEEEEE" ForeColor="Black" />
                            <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
                            <SortedAscendingCellStyle BackColor="#F1F1F1" />
                            <SortedAscendingHeaderStyle BackColor="#0000A9" />
                            <SortedDescendingCellStyle BackColor="#CAC9C9" />
                            <SortedDescendingHeaderStyle BackColor="#000065" />
                        </asp:GridView>
                        <asp:SqlDataSource ID="SqlDataSourceTours" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                            
                            
                            SelectCommand="SELECT ROW_NUMBER() OVER (ORDER BY dbo.tblTour.ID DESC) AS ROW, dbo.tblTour.ID, dbo.tblTour.TieuDe, dbo.tblTour.HinhAnh, dbo.tblTour.GhiChu, dbo.tblTour.TheLoaiID, dbo.tblTheLoai.TenTheLoai, dbo.tblTour.Hot, dbo.tblTour.STT, dbo.tblDanhMuc.TenDanhMuc FROM dbo.tblTour INNER JOIN dbo.tblTheLoai ON dbo.tblTour.TheLoaiID = dbo.tblTheLoai.ID INNER JOIN dbo.tblDanhMuc ON dbo.tblTheLoai.MaDanhMuc = dbo.tblDanhMuc.ID and dbo.tblDanhMuc.TypeID=4"></asp:SqlDataSource>
                    </td>
                </tr>
            </table>
        </asp:View>
        <asp:View ID="viewCreate" runat="server">
            <table class="style1">
                <tr>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td align="right">
                        <asp:Button ID="btnBack" runat="server" Text="Quay lại" 
                            CausesValidation="False" onclick="btnCancel_Click" />
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;</td>
                    <td>
                        Thể loại:</td>
                    <td>
                        <asp:DropDownList ID="cbxTheLoai" runat="server" Width="200px" 
                            DataSourceID="SqlDataSourceTheLoai" DataTextField="TenTheLoai" 
                            DataValueField="ID">
                        </asp:DropDownList>
                        <asp:SqlDataSource ID="SqlDataSourceTheLoai" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                            
                            
                            SelectCommand="SELECT dbo.tblTheLoai.TenTheLoai, dbo.tblTheLoai.ID, dbo.tblDanhMuc.TypeID FROM dbo.tblTheLoai INNER JOIN dbo.tblDanhMuc ON dbo.tblTheLoai.MaDanhMuc = dbo.tblDanhMuc.ID WHERE (dbo.tblDanhMuc.TypeID = 4)">
                        </asp:SqlDataSource>
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;</td>
                    <td>
                        Tiêu đề:</td>
                    <td>
                        <asp:TextBox ID="txtTieuDe" runat="server" Width="400px"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                            ControlToValidate="txtTieuDe" ErrorMessage="(*)" ForeColor="Red"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;</td>
                    <td>
                        Hình ảnh:</td>
                    <td>
                        <asp:FileUpload ID="fileUpload" runat="server" />
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                            ControlToValidate="fileUpload" ErrorMessage="(*)" ForeColor="Red"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        <asp:TextBox ID="txtViTri" runat="server" Width="50px" Visible="False">1</asp:TextBox>
                        &nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                            ControlToValidate="txtViTri" ErrorMessage="(*)" ForeColor="Red" 
                            Visible="False"></asp:RequiredFieldValidator>
                        <asp:CheckBox ID="ckbHot" runat="server" Visible="False" />
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;</td>
                    <td>
                        Nội dung:</td>
                    <td>
                        <FCKeditorV2:FCKeditor ID="txtGhiChu" runat="server" Height="500px">
                        </FCKeditorV2:FCKeditor>
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        <asp:Button ID="btnCreate" runat="server" Text="Lưu" 
                            onclick="btnCreate_Click" />
                        &nbsp;<asp:Button ID="btnCancel" runat="server" Text="Hủy" 
                            CausesValidation="False" onclick="btnCancel_Click" />
                    </td>
                </tr>
            </table>
        </asp:View>
        <asp:View ID="viewEdit" runat="server">
        <table class="style1">
                <tr>
                    <td>
                        &nbsp;</td>
                    <td>
                        <asp:HiddenField ID="hfID" runat="server" />
                        <asp:HiddenField ID="hfImage" runat="server" />
                    </td>
                    <td align="right">
                        <asp:Button ID="Button5" runat="server" Text="Quay lại" 
                            CausesValidation="False" onclick="btnCancel_Click" />
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;</td>
                    <td>
                        Thể loại:</td>
                    <td>
                        <asp:DropDownList ID="cbxTheLoaiEdit" runat="server" Width="200px" 
                            DataSourceID="SqlDataSourceTheLoai" DataTextField="TenTheLoai" 
                            DataValueField="ID">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;</td>
                    <td>
                        Tiêu đề:</td>
                    <td>
                        <asp:TextBox ID="txtTieuDeEdit" runat="server" Width="400px"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                            ControlToValidate="txtTieuDeEdit" ErrorMessage="(*)" ForeColor="Red"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;</td>
                    <td>
                        Hình ảnh:</td>
                    <td>
                        <asp:Image ID="imageTour" runat="server" Height="98px" Width="91px" />
                        <asp:LinkButton ID="btnIGM" runat="server" onclick="btnIGM_Click" 
                            CausesValidation="False">Đổi ảnh</asp:LinkButton>
                        &nbsp;<asp:LinkButton ID="btnHuy" runat="server" CausesValidation="False" 
                            onclick="btnHuy_Click" Visible="False">Hủy</asp:LinkButton>
                        <asp:FileUpload ID="fileUploadEdit" runat="server" Visible="False" />
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" 
                            ControlToValidate="fileUploadEdit" ErrorMessage="(*)" ForeColor="#CC0000"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;</td>
                    <td>
                        Vị trí hiện thị:</td>
                    <td>
                        <asp:TextBox ID="txtViTriEdit" runat="server" Width="50px" Visible="False">1</asp:TextBox>
                        &nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                            ControlToValidate="txtViTriEdit" ErrorMessage="(*)" ForeColor="Red" 
                            Visible="False"></asp:RequiredFieldValidator>
                        <asp:CheckBox ID="ckbHotEdit" runat="server" Visible="False" />
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;</td>
                    <td>
                        Nội dung:</td>
                    <td>
                        <FCKeditorV2:FCKeditor ID="txtGhiChuEdit" runat="server" Height="500px">
                        </FCKeditorV2:FCKeditor>
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        <asp:Button ID="btnEditSave" runat="server" Text="Sửa" 
                            onclick="btnEditSave_Click" />
                        &nbsp;<asp:Button ID="Button7" runat="server" Text="Hủy" 
                            CausesValidation="False" onclick="btnCancel_Click" />
                    </td>
                </tr>
            </table>
        </asp:View>
    </asp:MultiView>
</asp:Content>